var echarts = require("echarts");

function v2Equal(a, b) {
  return a && b && a[0] === b[0] && a[1] === b[1];
}

var _default = echarts.extendComponentModel({
  type: 'bingmap',
  getBingMap: function () {
    // __bingmap is injected when creating BingMapCoordSys
    return this.__bingmap;
  },
  setCenterAndZoom: function (center, zoom) {
    console.log('setCenterAndZoom', center, zoom)
    // debugger
    this.option.viewOption.center = center;
    this.option.viewOption.zoom = zoom;
  },
  centerOrZoomChanged: function (center, zoom) {
    var option = this.option.viewOption;
    return !(v2Equal(center, option.center) && zoom === option.zoom);
  },
  defaultOption: {
    viewOption: {
      // 支持两种格式，
      // [lng, lat]
      // {lng, lat}
      center: [113.493471, 23.169598],
      zoom: 5,
    },
    // 关于mapOption的更多选项，参考这里 http://www.bingmap.cn/guide/e0411686-dafe-11e8-aa18-d46d6d978bfa?module=doc
    mapOption: {
      customMapStyle: {},
    }
  }
});

module.exports = _default;